#define _CRT_SECURE_NO_WARNINGS 1
#include <iostream>
#include<string>
using namespace std;

int main() {
    string a;
    int len = 0;
    getline(cin, a);
    int n = a.size();
    for (int i = 0; i < n; i++) {
        if (a[i] == ' ')
            len = max(len, i);
    }
    if (len == 0)
        printf("%d", n);
    else
    printf("%d", n - len - 1);
}
